package demo1;

public class Login {
    private String userName = "hello";
    private String passWord = "123456";

    public void logininfo(String userName, String passWord) throws UserNameException, PassWordException{
        if(!this.userName.equals(userName)){
            throw new UserNameException("用户名错误");
        }
        if(!this.passWord.equals(passWord)){
            throw new PassWordException("密码错误");
        }
        System.out.println("登录成功！");
    }

    public static void main(String[] args) throws UserNameException, PassWordException{
        Login user = new Login();
        user.logininfo("world","111111");
    }
}